package com.teamwe.movecard.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;

@Data
@Entity
@Table(name = "score")
@ApiModel(description = "分数对象")
public class Score {
    @Id
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @ApiModelProperty(notes = "微信用户唯一标识，主键", name = "openId")
    private String mpOpenId;
    //分数

    @ApiModelProperty(notes = "分数", name = "score")
    private int score;

    @OneToOne(targetEntity = User.class)
    @JoinColumn(name = "mpOpenId")
    private User user;

    @Override
    public String toString() {
        return "Score{" +
                "openId='" + mpOpenId + '\'' +
                ", score=" + score +
                ", user=" + user +
                '}';
    }
}
